/**
 * @version Create on 2012-11-13
 * @author Yinzi Chen
 */

public class IntegerToRoman {

	static final String roman[] = new String[] { "I", "IV", "V", "IX", "X",
			"XL", "L", "XC", "C", "CD", "D", "CM", "M" };
	static final int cnt[] = new int[] { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400,
			500, 900, 1000 };

	public String intToRoman(int num) {
		String s = "";
		for (int i = roman.length - 1; i >= 0; --i) {
			while (num >= cnt[i]) {
				num -= cnt[i];
				s += roman[i];
			}
		}
		return s;
	}

	public static void main(String[] args) {

	}

}
